#ifndef MESHLOADER_H
#define MESHLOADER_H

#include <QtCore/QVector>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QList>

struct Vertex
{
    Vertex(float xx=0, float yy=0, float zz=0): x(xx), y(yy), z(zz){}
    float x; float y; float z;
};

struct Face
{
    Face(int vv1=0, int vv2=0, int vv3=0, int t1=0, int t2=0, int t3=0): v1(vv1), v2(vv2), v3(vv3), tex1(t1), tex2(t2), tex3(t3){}
    int v1; int v2; int v3;
    int tex1; int tex2; int tex3;
};

struct Texture
{
    Texture(float u=0, float v=0 ): uTex(u), vTex(v){}
    float uTex; float vTex;
};

struct Object
{
    QString objectName;
    QVector <Vertex>  vNormals;
    QVector <Face> vFaces;
};

class Mesh
{
public:
    void ReadObjFile(char *strFileName);
    void ReadVertexInfo();
    void ReadFaceInfo();
    void ComputeNormals();
    void FillInObjectInfo();
    void draw(QString objectName);

private:
    int objCounter;
    QList <Object> objects;
    QVector <Vertex>  vertices;
    QVector <Face> faces;
    QVector <Vertex> normals;
    QString objName;
    QString str;
    QStringList strList;
    int idText;
    int idTerrain;
    int idSSculpture;
    int idMSculpture1;
    int idMSculpture2;
    int idFSculpture1;
    int idFSculpture2;
    int idPairSculpture;
    int idFChildSculpture;
    int idHands;
    int idRuins;

};

#endif // MESHLOADER_H
